INCLUDE = -I/usr/include/
LIBDIR  = -L/usr/X11R6/lib 

COMPILERFLAGS = -Wall
CC = g++
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
LIBRARIES = -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm
#LIBRARIES = -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm -lglui

LD = $(CC)
LDFLAGS = -g

PROGRAM = gameit
OBJECTS = main.o GameProject.o GameScene.o SceneNode.o BasicElement.o Board.o Carinha.o Comida.o XGLObject.o xmlParser.o

$(PROGRAM) : $(OBJECTS)
	$(LD) $(LDFLAGS) $^ -o $@ $(LIBDIR) $(LIBRARIES)

main.o: main.cpp GameProject.h OBJLoader.h
GameProject.o: GameProject.cpp GameProject.h
GameScene.o: GameScene.cpp GameScene.h SceneNode.h Board.h
SceneNode.o: SceneNode.cpp SceneNode.h SceneElement.h
BasicElement.o: BasicElement.cpp BasicElement.h SceneElement.h
Board.o: Board.cpp Board.h BasicElement.h
Carinha.o: Carinha.cpp Carinha.h BasicElement.h
Comida.o: Comida.cpp Comida.h BasicElement.h
OBJLoader.o: OBJLoader.cpp OBJLoader.h
XGLObject.o: XGLObject.cpp XGLObject.h xmlParser.h
xmlParser.o: xmlParser.cpp xmlParser.h

%.o : %.cpp
	$(CC) $(CFLAGS) -c $< -o $@

.PHONY : allclear clear cleanest run
run:
		./gameit
remove:
		rm *.o $(PROGRAM) GAMELOG_GameProject.txt
clear: 
		rm *.o
cleanest:
		rm *~


#all: 
#	$(CC) $(CFLAGS) main.cpp GameProject.cpp GameScene.cpp SceneNode.cpp -o programa $(LIBDIR) $(LIBRARIES)
#	rm *~
#
#clean: 
#	 rm programa
